package hy.config;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyCfg {
    @Value("${spring.redis.host}")
    String ip;
    @Value("${spring.redis.port}")
    String port;
    @Bean
    public Redisson red(){
        Config cfg=new Config();
        cfg.useSingleServer().setAddress("redis://"+ip+":"+port);
        return (Redisson) Redisson.create(cfg);
    }
}